var express = require('express');
var multer = require('multer');
var upload = multer({ dest: 'public/uploads' });
var router = express.Router();

// GET: Homepage
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

// GET: Webuploader
router.get('/webuploader', function (req, res, next) {
    res.render('webuploader');
});

// POST: API.Upload
router.post('/api/upload', upload.array('file'), function (req, res, next) {
  console.log('::: FILE', req.file);
  console.log('::: FILES', req.files);
  console.log('::: BODY', req.body);
  res.json({});
});

module.exports = router;
